package com.landeb.shop.huo.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.PagerAdapter;
import android.view.View;

import com.landeb.shop.huo.frag.OrderFragment;

import java.util.List;

/**
 * Created by blade on 2016/11/23.
 */

public class ActOrderTabVPAdapter extends FragmentPagerAdapter {

    private List<String> tabNames;
    private List<OrderFragment> fragments;

    public ActOrderTabVPAdapter(FragmentManager fm, List<String> tabNames, List<OrderFragment> fragments) {
        super(fm);
        this.tabNames = tabNames;
        this.fragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    /**
     * 这个函数就是给TabLayout的Tab设定Title
     */
    @Override
    public CharSequence getPageTitle(int position) {
        return tabNames.get(position);
    }


}
